StupidBeauty
Read times:515Posted at:Sun Jan 15 05:08:29 2012
- no title specified

Wt3.2.0文档翻译:Wt::WFileResource类参考,Wt::WFileResource Class Reference

详细描述

这是一個资源,它将一個本地文件中的数据变成流。

要想更新这個资源的话,有两种方法:使用setFileName()来让它指向一個新的文件;如果文件名没变,而文件内容变咯的话,则发射WResource::dataChanged()信号。

资源會利用续传来将数据分片地发送,这样就不會阻塞线程,也不會将整个文件读入内存。可使用setBufferSize()来改变缓存的大小。

使用示例:

Wt::WFileResource *csvFile = new Wt::WFileResource("text/csv", "/opt/files/afile.csv");

csvFile->suggestFileName("data.csv");

Wt::WAnchor *anchor = new Wt::WAnchor(csvFile, "CSV data");

Wt::WFileResource *imageFile = new Wt::WFileResource("image/png", "/opt/files/image.png");

imageFile->suggestFileName("data.png");

Wt::WImage *image = new Wt::WImage(imageFile, "PNG version");

参考:

WStreamResource, WMemoryResource

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4